##parameters=xml, xml_file, new_identities=None

#from Products.KnowledgeEngine.GenericObject import GenericObject

### TODO: Support uploaded files, more formats (i.e. gzip, gzip+uuencode, etc)

if xml_file:
    xml = xml_file.read()
    
recalculateIdentities = ( new_identities == 'Y' )


context.knowledgeengine_tool.importObjectFromXML( context, xml, recalculateIdentities=recalculateIdentities )


#if new_identities == 'Y':
    #for object in objects:
        #object.onAfterClone()


redirect = context.REQUEST.RESPONSE.redirect

return redirect( context.absolute_url() + "?portal_status_message=Object imported" )